{"ast":null,"code":"var _jsxFileName = \"/data/messenger.client/src/pages/Home/Profile/index.tsx\",\n  _s = $RefreshSig$();\nimport React from 'react';\nimport { Toggle } from \"../../../components/\";\nimport { Circle } from 'rc-progress';\nimport { observer } from \"mobx-react-lite\";\nimport { Context } from \"../../../index\";\nimport { profileCompletionPercentage } from \"../../../utils/User\";\nimport Switch from '@mui/material/Switch';\nimport { Button, UserProfile, Modal, Error } from '../../../components';\nimport { ChangeProfileForm } from '../../../modules/';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nconst Profile = () => {\n  _s();\n  const {\n    store\n  } = React.useContext(Context);\n  const [profilePercent, setProfilePercent] = React.useState(0);\n  const [disableToggle, setDisableToggle] = React.useState(true);\n  const [showModal, setShowModal] = React.useState(false);\n  const [showUserEdit, setShowUserEdit] = React.useState(false);\n  const [profile, setProfile] = React.useState(store.getProfile());\n  const memoizedProfile = React.useMemo(() => profileCompletionPercentage(store.getProfile()),\n  // eslint-disable-next-line react-hooks/exhaustive-deps\n  [store.profile]);\n  React.useEffect(() => {\n    var _profile$content;\n    setProfilePercent(memoizedProfile);\n    setProfile(store.getProfile());\n    console.log((_profile$content = profile.content) === null || _profile$content === void 0 ? void 0 : _profile$content.items);\n  }, [store.profile]);\n  return /*#__PURE__*/_jsxDEV(\"section\", {\n    className: \"home\",\n    children: /*#__PURE__*/_jsxDEV(\"div\", {\n      className: \"messenger\",\n      children: [/*#__PURE__*/_jsxDEV(\"div\", {\n        className: \"messenger__sidebar\",\n        children: [/*#__PURE__*/_jsxDEV(Toggle, {}, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 37,\n          columnNumber: 21\n        }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"messenger__sidebar-item\",\n          children: [/*#__PURE__*/_jsxDEV(\"div\", {\n            className: \"messenger__sidebar-item-header\",\n            children: /*#__PURE__*/_jsxDEV(\"div\", {\n              className: \"messenger__sidebar-item-header-top\",\n              children: /*#__PURE__*/_jsxDEV(\"span\", {\n                children: \"\\u041D\\u0430\\u0441\\u0442\\u0440\\u043E\\u0439\\u043A\\u0438 \\u043F\\u0440\\u043E\\u0444\\u0438\\u043B\\u044F\"\n              }, void 0, false, {\n                fileName: _jsxFileName,\n                lineNumber: 41,\n                columnNumber: 33\n              }, this)\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 40,\n              columnNumber: 29\n            }, this)\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 39,\n            columnNumber: 25\n          }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n            className: \"messenger__sidebar-profile\",\n            children: [/*#__PURE__*/_jsxDEV(Circle, {\n              percent: profilePercent,\n              strokeWidth: 3,\n              className: \"messenger__sidebar-profile-progress\"\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 45,\n              columnNumber: 29\n            }, this), /*#__PURE__*/_jsxDEV(\"p\", {\n              className: \"messenger__sidebar-profile-progressInfo\",\n              children: [\"\\u041F\\u0440\\u043E\\u0444\\u0438\\u043B\\u044C \\u0437\\u0430\\u043F\\u043E\\u043B\\u043D\\u0435\\u043D \\u043D\\u0430: \", profilePercent.toString().slice(0, 5), \"%\"]\n            }, void 0, true, {\n              fileName: _jsxFileName,\n              lineNumber: 50,\n              columnNumber: 29\n            }, this)]\n          }, void 0, true, {\n            fileName: _jsxFileName,\n            lineNumber: 44,\n            columnNumber: 25\n          }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n            className: \"messenger__sidebar-profileControl\",\n            children: [/*#__PURE__*/_jsxDEV(\"div\", {\n              className: \"messenger__sidebar-profileControl-top\",\n              children: [/*#__PURE__*/_jsxDEV(Switch, {\n                checked: !disableToggle,\n                onChange: () => setDisableToggle(!disableToggle),\n                name: \"special\"\n              }, void 0, false, {\n                fileName: _jsxFileName,\n                lineNumber: 56,\n                columnNumber: 33\n              }, this), /*#__PURE__*/_jsxDEV(\"span\", {\n                className: \"messenger__sidebar-profileControl-top-toggleInfo\",\n                children: \"\\u0421\\u043F\\u0435\\u0446\\u0438\\u0430\\u043B\\u044C\\u043D\\u044B\\u0435 \\u0432\\u043E\\u0437\\u043C\\u043E\\u0436\\u043D\\u043E\\u0441\\u0442\\u0438\"\n              }, void 0, false, {\n                fileName: _jsxFileName,\n                lineNumber: 61,\n                columnNumber: 33\n              }, this)]\n            }, void 0, true, {\n              fileName: _jsxFileName,\n              lineNumber: 55,\n              columnNumber: 29\n            }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n              className: \"messenger__sidebar-profileControl-main\",\n              children: [/*#__PURE__*/_jsxDEV(Button, {\n                customClassName: \"messenger__sidebar-profileControl-changeProfile\",\n                fullWidth: false,\n                text: !disableToggle ? 'Изменить профиль' : '',\n                disable: disableToggle,\n                callback: () => setShowUserEdit(!showUserEdit)\n              }, void 0, false, {\n                fileName: _jsxFileName,\n                lineNumber: 66,\n                columnNumber: 33\n              }, this), /*#__PURE__*/_jsxDEV(Button, {\n                customClassName: \"messenger__sidebar-profileControl-deleteProfile\",\n                fullWidth: false,\n                text: !disableToggle ? 'Удалить профиль' : '',\n                disable: disableToggle,\n                callback: () => setShowModal(!showModal)\n              }, void 0, false, {\n                fileName: _jsxFileName,\n                lineNumber: 73,\n                columnNumber: 33\n              }, this)]\n            }, void 0, true, {\n              fileName: _jsxFileName,\n              lineNumber: 65,\n              columnNumber: 29\n            }, this)]\n          }, void 0, true, {\n            fileName: _jsxFileName,\n            lineNumber: 54,\n            columnNumber: 25\n          }, this), /*#__PURE__*/_jsxDEV(Modal, {\n            active: showModal,\n            title: \"Удаление профиля\",\n            hasFunctionButtons: true,\n            onSubmit: () => store.deleteProfileFromAPI(),\n            onClose: () => setShowModal(false),\n            customClassNameButtonSecond: \"messenger__sidebar-profileControl-deleteProfile\",\n            children: /*#__PURE__*/_jsxDEV(\"div\", {\n              children: \"\\u0412\\u044B \\u0434\\u0435\\u0439\\u0441\\u0442\\u0432\\u0438\\u0442\\u0435\\u043B\\u044C\\u043D\\u043E \\u0445\\u043E\\u0442\\u0438\\u0442\\u0435 \\u0431\\u0435\\u0437\\u0432\\u043E\\u0437\\u0432\\u0440\\u0430\\u0442\\u043D\\u043E \\u0443\\u0434\\u0430\\u043B\\u0438\\u0442\\u044C \\u043F\\u0440\\u043E\\u0444\\u0438\\u043B\\u044C?\"\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 90,\n              columnNumber: 29\n            }, this)\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 82,\n            columnNumber: 25\n          }, this), /*#__PURE__*/_jsxDEV(Error, {\n            text: 'Пользователь с таким псевдонимом уже существует!'\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 92,\n            columnNumber: 25\n          }, this)]\n        }, void 0, true, {\n          fileName: _jsxFileName,\n          lineNumber: 38,\n          columnNumber: 21\n        }, this)]\n      }, void 0, true, {\n        fileName: _jsxFileName,\n        lineNumber: 36,\n        columnNumber: 17\n      }, this), !showUserEdit && /*#__PURE__*/_jsxDEV(\"div\", {\n        className: \"messenger__imProfile\",\n        children: profile.id && /*#__PURE__*/_jsxDEV(UserProfile, {\n          profile: profile\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 97,\n          columnNumber: 36\n        }, this)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 96,\n        columnNumber: 17\n      }, this) || /*#__PURE__*/_jsxDEV(\"div\", {\n        className: \"messenger__imProfile\",\n        children: profile.id && /*#__PURE__*/_jsxDEV(ChangeProfileForm, {\n          cancel: () => setShowUserEdit(false),\n          profile: profile\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 100,\n          columnNumber: 36\n        }, this)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 99,\n        columnNumber: 17\n      }, this)]\n    }, void 0, true, {\n      fileName: _jsxFileName,\n      lineNumber: 35,\n      columnNumber: 13\n    }, this)\n  }, void 0, false, {\n    fileName: _jsxFileName,\n    lineNumber: 34,\n    columnNumber: 9\n  }, this);\n};\n_s(Profile, \"LVL7lzvztfJMAmiFfVY9Wwr1d2E=\");\n_c = Profile;\nexport default _c2 = observer(Profile);\nvar _c, _c2;\n$RefreshReg$(_c, \"Profile\");\n$RefreshReg$(_c2, \"%default%\");","map":{"version":3,"names":["React","Toggle","Circle","observer","Context","profileCompletionPercentage","Switch","Button","UserProfile","Modal","Error","ChangeProfileForm","Profile","store","useContext","profilePercent","setProfilePercent","useState","disableToggle","setDisableToggle","showModal","setShowModal","showUserEdit","setShowUserEdit","profile","setProfile","getProfile","memoizedProfile","useMemo","useEffect","console","log","content","items","toString","slice","deleteProfileFromAPI","id"],"sources":["/data/messenger.client/src/pages/Home/Profile/index.tsx"],"sourcesContent":["import React from 'react';\nimport {Toggle} from \"../../../components/\";\nimport  {Circle} from 'rc-progress';\nimport {observer} from \"mobx-react-lite\";\nimport {Context} from \"../../../index\";\nimport {profileCompletionPercentage} from \"../../../utils/User\";\nimport Switch from '@mui/material/Switch';\nimport {Button, UserProfile, Modal, Error} from '../../../components'\nimport {ChangeProfileForm} from '../../../modules/';\nimport {UserListItem} from \"../../../models/response/UserListItem\";\n\nconst Profile = () => {\n    const {store} = React.useContext(Context);\n    const [profilePercent, setProfilePercent] = React.useState<number>(0);\n    const [disableToggle, setDisableToggle] = React.useState<boolean>(true);\n    const [showModal, setShowModal] = React.useState<boolean>(false);\n    const [showUserEdit, setShowUserEdit] = React.useState<boolean>(false);\n    const [profile, setProfile] = React.useState<UserListItem>(store.getProfile());\n\n    const memoizedProfile = React.useMemo(\n        () => profileCompletionPercentage(store.getProfile()),\n        // eslint-disable-next-line react-hooks/exhaustive-deps\n        [store.profile]\n    );\n\n    React.useEffect(() => {\n        setProfilePercent(memoizedProfile);\n        setProfile(store.getProfile());\n        console.log(profile.content?.items)\n\n    },[store.profile]);\n\n    return (\n        <section className=\"home\">\n            <div className=\"messenger\">\n                <div className=\"messenger__sidebar\">\n                    <Toggle />\n                    <div className=\"messenger__sidebar-item\">\n                        <div className=\"messenger__sidebar-item-header\">\n                            <div className=\"messenger__sidebar-item-header-top\">\n                                <span>Настройки профиля</span>\n                            </div>\n                        </div>\n                        <div className=\"messenger__sidebar-profile\">\n                            <Circle\n                                percent={profilePercent}\n                                strokeWidth={3}\n                                className=\"messenger__sidebar-profile-progress\"\n                            />\n                            <p className=\"messenger__sidebar-profile-progressInfo\">\n                                Профиль заполнен на: {profilePercent.toString().slice(0, 5)}%\n                            </p>\n                        </div>\n                        <div className=\"messenger__sidebar-profileControl\">\n                            <div className=\"messenger__sidebar-profileControl-top\">\n                                <Switch\n                                    checked={!disableToggle}\n                                    onChange={() => setDisableToggle(!disableToggle)}\n                                    name=\"special\"\n                                />\n                                <span className=\"messenger__sidebar-profileControl-top-toggleInfo\">\n                                Специальные возможности\n                            </span>\n                            </div>\n                            <div className=\"messenger__sidebar-profileControl-main\">\n                                <Button\n                                    customClassName=\"messenger__sidebar-profileControl-changeProfile\"\n                                    fullWidth={false}\n                                    text={!disableToggle?'Изменить профиль':''}\n                                    disable={disableToggle}\n                                    callback={() => setShowUserEdit(!showUserEdit)}\n                                />\n                                <Button\n                                    customClassName=\"messenger__sidebar-profileControl-deleteProfile\"\n                                    fullWidth={false}\n                                    text={!disableToggle?'Удалить профиль':''}\n                                    disable={disableToggle}\n                                    callback={() => setShowModal(!showModal)}\n                                />\n                            </div>\n                        </div>\n                        <Modal\n                            active={showModal}\n                            title={\"Удаление профиля\"}\n                            hasFunctionButtons={true}\n                            onSubmit={() => store.deleteProfileFromAPI()}\n                            onClose={() => setShowModal(false)}\n                            customClassNameButtonSecond={\"messenger__sidebar-profileControl-deleteProfile\"}\n                        >\n                            <div>Вы действительно хотите безвозвратно удалить профиль?</div>\n                        </Modal>\n                        <Error text={'Пользователь с таким псевдонимом уже существует!'} />\n                    </div>\n                </div>\n                {(!showUserEdit &&\n                <div className=\"messenger__imProfile\">\n                    {profile.id && <UserProfile profile={profile} />}\n                </div>) ||\n                <div className=\"messenger__imProfile\">\n                    {profile.id && <ChangeProfileForm\n                        cancel={() => setShowUserEdit(false)}\n                        profile={profile}\n                    />}\n                </div>}\n            </div>\n        </section>\n    );\n}\n\nexport default observer(Profile);"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAQC,MAAM,QAAO,sBAAsB;AAC3C,SAASC,MAAM,QAAO,aAAa;AACnC,SAAQC,QAAQ,QAAO,iBAAiB;AACxC,SAAQC,OAAO,QAAO,gBAAgB;AACtC,SAAQC,2BAA2B,QAAO,qBAAqB;AAC/D,OAAOC,MAAM,MAAM,sBAAsB;AACzC,SAAQC,MAAM,EAAEC,WAAW,EAAEC,KAAK,EAAEC,KAAK,QAAO,qBAAqB;AACrE,SAAQC,iBAAiB,QAAO,mBAAmB;AAAC;AAGpD,MAAMC,OAAO,GAAG,MAAM;EAAA;EAClB,MAAM;IAACC;EAAK,CAAC,GAAGb,KAAK,CAACc,UAAU,CAACV,OAAO,CAAC;EACzC,MAAM,CAACW,cAAc,EAAEC,iBAAiB,CAAC,GAAGhB,KAAK,CAACiB,QAAQ,CAAS,CAAC,CAAC;EACrE,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAGnB,KAAK,CAACiB,QAAQ,CAAU,IAAI,CAAC;EACvE,MAAM,CAACG,SAAS,EAAEC,YAAY,CAAC,GAAGrB,KAAK,CAACiB,QAAQ,CAAU,KAAK,CAAC;EAChE,MAAM,CAACK,YAAY,EAAEC,eAAe,CAAC,GAAGvB,KAAK,CAACiB,QAAQ,CAAU,KAAK,CAAC;EACtE,MAAM,CAACO,OAAO,EAAEC,UAAU,CAAC,GAAGzB,KAAK,CAACiB,QAAQ,CAAeJ,KAAK,CAACa,UAAU,EAAE,CAAC;EAE9E,MAAMC,eAAe,GAAG3B,KAAK,CAAC4B,OAAO,CACjC,MAAMvB,2BAA2B,CAACQ,KAAK,CAACa,UAAU,EAAE,CAAC;EACrD;EACA,CAACb,KAAK,CAACW,OAAO,CAAC,CAClB;EA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